package com.msoe.client.panels;

import java.util.HashMap;
import com.msoe.client.Session;

/**
 * static map of panels
 * used to keep track of Panels
 * @author finleyb
 *
 */
public class PanelMap {

	//underlying map datastructure
	private static HashMap<String,MSOERPanel> hash = new HashMap<String,MSOERPanel>();

	/**
	 * private constructor for static class
	 */
	private PanelMap(){

	}
	
	public static void createPanels(Session session){
		hash.put("Login", PanelFactory.createPanelWithSession("Login",session));
		hash.put("Register", PanelFactory.createPanelWithSession("Register",session));
		hash.put("UserHome", PanelFactory.createPanelWithSession("UserHome",session));
		hash.put("AddRide", PanelFactory.createPanelWithSession("AddRide",session));
		hash.put("GetRide", PanelFactory.createPanelWithSession("GetRide",session));
		hash.put("AccountSettings", PanelFactory.createPanelWithSession("AccountSettings",session));
	}
	
	public static MSOERPanel getPanel(String name){
		return hash.get(name);
	}
	
	//this can help with keeping track of history
	public static void showPanel(MSOERPanel current, MSOERPanel next){
	  if(current != null){
		  current.hide();
	  }
	  next.show();
	}

}
